package com.xuetang9.fujian.threaddemo.bossdemo;

/**
 * @author: fujian
 * @description:
 * @date: 2021/5/3 9:24
 * @version: V1.0
 * @package: com.xuetang9.fujian.threaddemo.bossdemo
 **/
@SuppressWarnings("all")
public class Boss {
    private String name;
    private int hp;

    public Boss(String name, int hp) {
        this.name = name;
        this.hp = hp;
    }

    public synchronized void beAttacked(int attack){
        if (hp > 0) hp -= attack;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }
}
